#include"head.h"
int main(void)
{   
    int fd;
    connection(&fd);
    process_stat_t stat;
    transport_protocol_t tp;
    bzero(&stat,sizeof(stat));
    bzero(&tp,sizeof(tp));
    //登录
    while(1){
        if(stat.flag==0){
         login(fd,&stat,&tp);
        }
        bzero(&tp,sizeof(tp));
        memcpy(tp.curr_path,stat.curr_path,sizeof(tp.curr_path));
        memcpy(tp.token,stat.local_token,sizeof(tp.token));
        char comment[100];    
        bzero(comment,sizeof(comment));
        printf("请输入:\n");
        setvbuf(stdout, NULL, _IONBF, 0);
        printf("%s$",stat.curr_path);
        read(STDIN_FILENO,comment,sizeof(comment)-1);
        if(comment[0]=='\n'){
            continue;
        }
        analysis_execute(comment,fd,&stat,&tp);
        printf("\n");
    }
    return 0;
}

